from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from pirate_core import template_for_model
from tagging.models import Tag
from django.utils.translation import ugettext as _
from pirate_forum.models import ForumBlob

    
#Stance is a type of argument -- probably specified by admin
class Stance(models.Model):
    arg = models.CharField(max_length=20)
    
    def __unicode__(self):
        return self.arg
    
# An argument of {arg_type} that is attached to an Issue 
#This should be a pirate-wikipage instance
class Argument(ForumBlob):
    stance = models.ForeignKey(Stance)

    class Meta:
        verbose_name = _('argument')
        #help_text = _('Supply an Argument for your position.')
    
    def __unicode__(self):
        return self._meta.verbose_name

    def get_verbose_name(self):
        return self._meta.verbose_name
    
    def get_blob_key(self):
        return 'r'

    def taggable(self):
        return True

    #This must be added to all classes that can be tagged
    def get_absolute_url(self):
        content_type = ContentType.objects.get_for_model(self.__class__)
        path = "detail?_t=" + str(content_type.pk) + "&_o=" + str(self.pk) 
        return path
     
admin.site.register(Stance)
admin.site.register(Argument) 
